home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Free Software Collection: Marty 1
/
FM Towns Marty 1 Free Software Collection.iso
/
joke
/
fugaku
/
source
/
fugaku.c
next >
Wrap
Text File
|
1993-11-11
|
8KB
|
400 lines
/*
ハイパー富嶽三十六景
Version history : 1992-01-07 version 0.01
Last update : 1992-02-29 version 0.10
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <jctype.h>
#include <alldef.h>
#include "kygload.c" /* ver.0.10 */
char egbwork[ 1536 ];
char mousework[ 4096 ];
short mouseX;
short mouseY;
char button;
char buttonStack;
char *fn[] =
{ "logo.kyg",
"title.kyg",
"korega.kyg",
"fuji2.kyg",
"zyoou.kyg",
"sakasa.kyg",
"telepo.kyg",
"ufo.kyg",
"hosi.kyg",
"sentai.kyg",
"yukio.kyg",
"sinrei.kyg",
"sakkyoku.kyg",
"zyukai.kyg",
"50on.kyg",
"5byou.kyg",
"tendou.kyg",
"cyoukan.kyg",
"13kin.kyg",
"fcyaku.kyg",
"sagase.kyg",
"goko.kyg",
"robo.kyg",
"yamai.kyg",
"saigo.kyg",
"seizin.kyg",
"usi.kyg",
"cyou.kyg",
"isi.kyg",
"fujfuj.kyg",
"houkai.kyg",
"siki.kyg",
"sissou.kyg",
"susono.kyg",
"nisefuji.kyg",
"fujimi.kyg",
"tubo.kyg",
"service.kyg",
"end.kyg"
};
char *title[] =
{ "LOGO",
"Title",
"これが富士山だ!!",
"怒濤の富士つ-",
"富士女王様",
"絶景、逆さ富士",
"必殺、富士テレポーテーション",
"謎の円盤UFO",
"目指せ!富士の星!!",
"山岳戦隊 フジレンジャー",
"川口浩 探検隊シリーズ、富士山頂に巨大雪男を発見!",
"緊急発表、これが心霊写真だ!",
"ヨハン・セバスチャン・フジ・バッハ",
"真実の報道、富士の樹海",
"富士五十音",
"富士山大爆発五秒前!",
"富士中心説 【アルマゲストより】",
"富士鳥瞰図",
"13日の富士曜日",
"カメラが捕らえた、不時着の決定的瞬間!",
"フージィーを探せ",
"名所名跡の旅 富士五湖",
"富士ロボの逆襲",
"不治の病",
"富士の最後",
"怪獣大図鑑 フジ星人",
"富士と牛",
"大横綱 千代の富士",
"白い巨塔",
"怪獣フジフジ地帯",
"富士山崩壊!",
"ふじ式",
"疾走!",
"富士の裾野",
"偽フジ登場、敵か味方か?",
"戦慄、不死身の男",
"海洋生物シリーズ、ふじつぼ",
"過剰なサーヴィス",
"End"
};
void fugaku( void );
void print( int x, int y, char *s, int color );
void line( int x1, int y1, int x2, int y2, int func, int color, int bf );
void clear( int x1, int y1, int x2, int y2, int page, int mode );
void egbInit( void );
void mouseInit( void );
void graphicDisp( char *fn, int ef, int wf );
void paletteChange( int n, int g, int r, int b );
void fade( int pn, int mode );
void triggerOffWait( void );
void wait( unsigned long n, int cf );
void fugakuExit( void );
void main( void )
{
egbInit();
mouseInit();
fugaku();
fugakuExit();
}
void fugaku( void )
{
int n;
graphicDisp( fn[ 0 ], ON, OFF );
wait( 0x7000, 0 );
for( n = 1; n < 39; ++n )
{
if( n != 1 && n != 38 )
{
print( ( 640 - strlen( title[ n ] ) * 8 ) / 2, 230, title[ n ], 15 );
wait( 0x8000, 0 );
/* fade( 15, 1 );
EGB_clearScreen( egbwork );
paletteChange( 15, 255, 255, 255 );
*/
}
graphicDisp( fn[ n ], ON, OFF );
wait( 0x20000, 0 );
EGB_clearScreen( egbwork );
clear( 0, 0, 319, 239, 1, ( n == 38 ) ? 0 : 1 );
wait( 0x1000, 0 );
}
}
void print( int x, int y, char *s, int color )
{
int i;
int code;
char parea[ 256 ];
EGB_writeMode( egbwork, 0 );
EGB_color( egbwork, 0, color );
WORD( parea + 0 ) = x;
WORD( parea + 2 ) = y + 16;
WORD( parea + 4 ) = 0;
EGB_sjisString( egbwork, parea );
for( i = 0; i < strlen( s ); ++i )
{
if( iskanji( *( unsigned char * )( s + i ) ) != 0 && iskanji2( *( unsigned char * )( s + i + 1 ) ) != 0 )
{
WORD( parea + 0 ) = 2;
WORD( parea + 2 ) = *( short * )( s + i );
++i;
}
else
{ WORD( parea + 0 ) = 1;
BYTE( parea + 2 ) = *( s + i );
}
EGB_connectSjisString( egbwork, parea );
wait( 0x800, 0 );
}
}
void line( int x1, int y1, int x2, int y2, int func, int color, int bf )
{
int p = 0;
char parea[ 0x10 ];
EGB_writeMode( egbwork, func );
if( bf == LINE )
{ p = 2;
WORD( parea ) = 2;
}
else if( bf == BOX )
EGB_paintMode( egbwork, 0x0002 );
else if( bf == BOXFULL )
{ EGB_paintMode( egbwork, 0x0022 );
EGB_color( egbwork, 2, color );
}
EGB_color( egbwork, 0, color );
WORD( parea + p + 0 ) = x1;
WORD( parea + p + 2 ) = y1;
WORD( parea + p + 4 ) = x2;
WORD( parea + p + 6 ) = y2;
if( bf == LINE )
EGB_connect( egbwork, parea );
else
EGB_rectangle( egbwork, parea );
}
void clear( int x1, int y1, int x2, int y2, int page, int mode )
{
int x = ( x1 + x2 ) / 2;
int y = ( y1 + y2 ) / 2;
int i, j;
int xx, yy;
int vp;
static int dps[] = { 0, 5, 2, 7, 4, 9, 1, 6, 3, 8 };
if( mode == 1 )
{
EGB_writePage( egbwork, page );
for( j = 0; j < 3; ++j )
{ for( i = j; i <= ( ( x > y ) ? x : y ); i += 3 )
{ if( i <= x - x1 )
{ line( x + i, y1, x - i, y2, PSET, 0x8000, LINE );
line( x1 + i, y1, x2 - i, y2, PSET, 0x8000, LINE );
}
if( i <= y - y1 )
{ line( x1, y - i, x2, y + i, PSET, 0x8000, LINE );
line( x2, y1 + i, x1, y2 - i, PSET, 0x8000, LINE );
}
}
}
EGB_writePage( egbwork, 0 );
}
else
{
for( yy = 0; yy < 10; ++yy )
{
for( xx = 0; xx < 10; ++xx )
{
for( y = 0; y < 240; y += 10 )
{
for( x = 0; x < 320; x += 10 )
{
vp = ( x + dps[ xx ] ) * 2 + ( y + dps[ yy ] ) * 1024;
VRAM_putPixelW( vp + 0x40000, 0 );
}
}
}
}
}
}
void egbInit( void )
{
EGB_init( egbwork, 1536 );
EGB_resolution( egbwork, 0, 3 );
EGB_resolution( egbwork, 1, 10 );
EGB_displayPage( egbwork, 1, 3 );
EGB_writePage( egbwork, 1 );
EGB_displayStart( egbwork, 0, 0, 0 );
EGB_displayStart( egbwork, 2, 2, 2 );
EGB_displayStart( egbwork, 3, 319, 239 );
EGB_writePage( egbwork, 0 );
}
void mouseInit( void )
{
MOS_start( mousework, 4096 );
MOS_resolution( 0, 3 );
MOS_writePage( 0 );
MOS_horizon( 0, 624 );
MOS_vertical( 0, 464 );
}
void graphicDisp( char *fn, int ef, int wf )
{
int cond;
cond = KYGload( fn, ef, 1 );
EGB_writePage( egbwork, 0 );
if( wf == ON )
wait( 0, 0 );
}
void paletteChange( int n, int g, int r, int b )
{
char parea[ 0x10 ];
DWORD( parea + 0 ) = 1;
DWORD( parea + 4 ) = n;
BYTE( parea + 8 ) = b;
BYTE( parea + 9 ) = r;
BYTE( parea + 10 ) = g;
BYTE( parea + 11 ) = 0;
EGB_palette( egbwork, 1, parea );
}
void fade( int pn, int mode )
{
int i;
char parea[ 0x10 ];
DWORD( parea + 0 ) = 1;
DWORD( parea + 4 ) = pn;
BYTE( parea + 11 ) = 0;
if( mode == 0 )
{
for( i = 0; i < 256; i += 4 )
{
BYTE( parea + 8 ) = i;
BYTE( parea + 9 ) = i;
BYTE( parea + 10 ) = i;
EGB_palette( egbwork, 1, parea );
MOS_rdpos( &button, &mouseX, &mouseY );
if( button != 0 )
i += 12;
}
}
else
{
for( i = 255; i > 0; i -= 4 )
{
BYTE( parea + 8 ) = i;
BYTE( parea + 9 ) = i;
BYTE( parea + 10 ) = i;
EGB_palette( egbwork, 1, parea );
MOS_rdpos( &button, &mouseX, &mouseY );
if( button != 0 )
i -= 12;
}
}
}
void triggerOffWait( void )
{
do
{ MOS_rdpos( &button, &mouseX, &mouseY );
/* if( button == 3 )
fugakuExit();
*/
}
while( button != 0 );
}
void wait( unsigned long n, int cf )
{
unsigned long i;
MOS_disp( cf );
for( i = 0; ( n == 0 ) || ( i < n ) ; ++i )
{ MOS_rdpos( &button, &mouseX, &mouseY );
if( button != 0 )
{ buttonStack = button;
triggerOffWait();
break;
}
}
MOS_disp( 0 );
}
void fugakuExit( void )
{
EGB_writePage( egbwork, 1 );
EGB_clearScreen( egbwork );
EGB_writePage( egbwork, 0 );
EGB_clearScreen( egbwork );
MOS_end();
exit( 0 );
}